home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / ooo / f_0020 / sbasic.jar / text / sbasic / common / 03020103.xml < prev    next >
Encoding:
Extensible Markup Language  |  2003-08-01  |  8.0 KB  |  68 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>Open Statement[Runtime]</title><meta name="filename" content="text/sbasic/common/03020103"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         table.Tabelle1{
  5.                 }
  6.         span.Tabelle1A{
  7.                 width:1.499cm;}
  8.         span.Tabelle1B{
  9.                 width:16.498cm;}
  10.         tr.Tabelle11{
  11.                 }
  12.         td.Tabelle1A1{
  13.                 }
  14.         p.P1{
  15.                 }
  16.         span.T1{
  17.                 font-weight:bold;}
  18.         span.fr1{
  19.                 }
  20.         </style></head><body>
  21.   
  22.   
  23.   <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="open" xmlns:help="http://openoffice.org/2000/help"><a name="open"/>
  24.   <p class="Head1"><help:paragraphinfo state="U" number="1"/><help:key-word value="Open; statement" tag="kw66386_1"/><help:link Id="66386">Open Statement[Runtime]</help:link></p>
  25.   <p class="Paragraph"><help:paragraphinfo state="U" number="2"/>Opens a data channel.</p>
  26.   <help:paragraphinfo state="E"/></help:to-be-embedded>
  27.   <p class="Head2"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>Syntax:</p>
  28.   <p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>Open FileName As String [For Modus] [Access IOMode] [protected] As [#]FileName As Integer [Len = Datasetlength]</p>
  29.   <p class="Head2"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>Parameters:</p>
  30.   <p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">FileName: </span>Name and path of the file that you wan to open. If you try to read a file that does not exist (Access = Read), an error message appears. If you try to write to a file that does exist (Access = Write), a new file is <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>created.</p>
  31.   <p class="Paragraph"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Mode:</span> Keyword that specifies the file mode. Valid values: Append (append to sequential file), binary (data can be accessed by bytes using Get and Put), Input (opens data channel for reading), Output (opens data channel for writing), and Random (edits relative files).</p>
  32.   <p class="Paragraph"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Access:</span> Keyword that defines the access type. Valid values: Read (read-only), Write (write-only), Read Write (both).</p>
  33.   <p class="Paragraph"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Protected:</span> Keyword that defines the security status of a file after opening. Valid values: Shared (file may be opened by other applications), Lock Read (file is protected against reading), Lock Write (file is protected against writing), Lock Read Write (denies file access).</p>
  34.   <p class="Paragraph"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">FileNumber:</span> Any integer expression from 0 to 511 to indicate the number of a free data channel. You can then pass commands through the data channel to access the file. The file number must be determined by the FreeFile function immediately before the Open statement.</p>
  35.   <p class="Paragraph"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">DatasetLength:</span> <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>For relative files, returns the length of a certain record. This parameter is only necessary if the file was opened for Random access.</p>
  36.   <table><tr class="Tabelle11"><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1A">
  37.       <p class="TextInTable"><draw:image draw:name="Icon0" svg:desc="This icon marks text containing additional information." svg:pixelx="32" svg:pixely="32" svg:width="0.847cm" svg:height="0.847cm" xlink:href="65980" draw:filter-name="" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
  38.  
  39.      </span></th><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1B">
  40.       <p class="TextInTable"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>You can only modify the contents of a file that was opened with the Open statement. If you try to open a file that is already open, an error message appears.</p>
  41.      </span></th></tr></table>
  42.   <p class="Head2"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>Example:</p>
  43.   <p class="PropText"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/>Sub ExampleWorkWithAFile</p>
  44.   <p class="PropText"><help:paragraphinfo state="U" number="15" xmlns:help="http://openoffice.org/2000/help"/>Dim iNumber As Integer</p>
  45.   <p class="PropText"><help:paragraphinfo state="U" number="16" xmlns:help="http://openoffice.org/2000/help"/>Dim sLine As String</p>
  46.   <p class="PropText"><help:paragraphinfo state="U" number="17" xmlns:help="http://openoffice.org/2000/help"/>Dim aFile As String</p>
  47.   <p class="PropText"><help:paragraphinfo state="U" number="40" xmlns:help="http://openoffice.org/2000/help"/>Dim sMsg as String</p>
  48.   <p class="PropText"><help:paragraphinfo state="U" number="18" xmlns:help="http://openoffice.org/2000/help"/>aFile = "c:\data.txt"</p>
  49.   <p class="PropText"><help:paragraphinfo state="U" number="19" xmlns:help="http://openoffice.org/2000/help"/></p>
  50.   <p class="PropText"><help:paragraphinfo state="U" number="20" xmlns:help="http://openoffice.org/2000/help"/>iNumber = Freefile</p>
  51.   <p class="PropText"><help:paragraphinfo state="U" number="21" xmlns:help="http://openoffice.org/2000/help"/>Open aFile For Output As #iNumber</p>
  52.   <p class="PropText"><help:paragraphinfo state="U" number="22" xmlns:help="http://openoffice.org/2000/help"/>Print #iNumber, "This is a line of text"</p>
  53.   <p class="PropText"><help:paragraphinfo state="U" number="23" xmlns:help="http://openoffice.org/2000/help"/>Print #iNumber, "This is another line of text"</p>
  54.   <p class="PropText"><help:paragraphinfo state="U" number="24" xmlns:help="http://openoffice.org/2000/help"/>Close #iNumber</p>
  55.   <p class="PropText"><help:paragraphinfo state="U" number="25" xmlns:help="http://openoffice.org/2000/help"/></p>
  56.   <p class="PropText"><help:paragraphinfo state="U" number="28" xmlns:help="http://openoffice.org/2000/help"/>iNumber = Freefile</p>
  57.   <p class="PropText"><help:paragraphinfo state="U" number="29" xmlns:help="http://openoffice.org/2000/help"/>Open aFile For Input As iNumber</p>
  58.   <p class="PropText"><help:paragraphinfo state="U" number="30" xmlns:help="http://openoffice.org/2000/help"/>While not eof(iNumber)</p>
  59.   <p class="PropText"><help:paragraphinfo state="U" number="31" xmlns:help="http://openoffice.org/2000/help"/>Line Input #iNumber, sLine</p>
  60.   <p class="PropText"><help:paragraphinfo state="U" number="32" xmlns:help="http://openoffice.org/2000/help"/>If sLine <>"" then</p>
  61.   <p class="PropText"><help:paragraphinfo state="U" number="33" xmlns:help="http://openoffice.org/2000/help"/>sMsg = sMsg & sLine & chr(13)</p>
  62.   <p class="PropText"><help:paragraphinfo state="U" number="35" xmlns:help="http://openoffice.org/2000/help"/>end if</p>
  63.   <p class="PropText"><help:paragraphinfo state="U" number="36" xmlns:help="http://openoffice.org/2000/help"/>wend</p>
  64.   <p class="PropText"><help:paragraphinfo state="U" number="37" xmlns:help="http://openoffice.org/2000/help"/>Close #iNumber</p>
  65.   <p class="PropText"><help:paragraphinfo state="U" number="41" xmlns:help="http://openoffice.org/2000/help"/>Msgbox sMsg</p>
  66.   <p class="PropText"><help:paragraphinfo state="U" number="38" xmlns:help="http://openoffice.org/2000/help"/>End Sub</p>
  67.   <p class="PropText"><help:paragraphinfo state="U" number="39" xmlns:help="http://openoffice.org/2000/help"/></p>
  68.  </body></html>